package com.atguigu.config;

import com.atguigu.bean.Person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;

/**
 * @author Honglixi
 * @create 2021-03-26 13:27
 */
//配置类=配置文件
@Configuration//告诉Spring这是一个配置类
@ComponentScan(value = "com.atguigu",includeFilters = {
//        @ComponentScan.Filter(type = FilterType.ANNOTATION,classes = {Controller.class})
        @ComponentScan.Filter(type = FilterType.CUSTOM,classes = MyTypeFilter.class)
},useDefaultFilters = false)//指定要扫描的包
/*

 */
public class MainConfig {
//    给容器中注册一个Bean。类型为返回值的类型，id默认是方法名作为id
    @Bean("person")
    public Person person(){
        return new Person("list",20);
    }
}
